<template>
     <div  ref="pages" >
        <div :class="[this.breadcrumbName==undefined ? '' : 'tabview newsPageDiv',]">
           <Breadcrumb 
            :breadcrumbName="breadcrumbName"
            :routerLikeTo="routerLikeTo"
            v-if='this.breadcrumbName!=undefined'
          />
          <span class="news-text">注意事项</span>   
          <a-divider style="margin: 20px 0;" />
          <div>
            <a-spin size="large" :spinning="loading" style="width:100%; text-align: center;" />
            <span v-html="noteData.contentDetails" v-if="!loading"></span>
          </div>
          
        </div>
       <!-- <footerPage :page="4"  :style="{'margin-top': footMarginTop}"></footerPage> -->
       
    </div>
</template>

<script>
//  import footerPage from '../../footer/footerPage';
import Breadcrumb from "@/components/base/tools/Breadcrumb1";
import emv from "@/views/center/emptyVue.vue";
import api from '@/api/index'
  export default {
    name: "note_report",
    inject: ["changeTab"],
     components: {
      //  footerPage,
       Breadcrumb
    },

     data(){
 
      return{
        clientHeight:'',
        screenHeight:'',
        breadList: [],
        breadcrumbName:'',
        routerLikeTo:'/center/reportCenterPage',
        loading: false,
        noteData:{
          // content:'水务工程安装，供水和污水处理项目开发，水务及环保项目咨询，建筑工程、 市政工程项目管理及工程监理，工程造价咨询，投资管理咨询，工程技术咨 询服务，道路交通工程项目管理。（以上项目凡涉及许可经营的凭许可经营） ',
        },
        pageFilter: {
          contentCategoryId:"155",
          pageNo:1,
          pageSize:1 ,
        },
      }
      
    },
    created(){
      this.breadcrumbName = this.$route.query.breadcrumbName;
      this.changeTab(7, "reportCenterPage", '<span class="tab_name">举报投诉</span>');
      this.get_note();
    },
    mounted(){
     this.setFootStyle();
    },
    methods: {
      getScreenHeight(){
        // 获取浏览器可视区域高度
        this.screenHeight =    document.body.clientHeight ; //`${document.documentElement.clientHeight}` 
        window.onresize = function temp() {
          this.screenHeight = document.body.clientHeight;
        };
      },
      async get_note() {
        this.loading = true;
         await api.get_news_list(this.pageFilter).then(res => {
           let data = res.rows;
            if(data.length>0){
              this.noteData = data[0];
               if(this.noteData && this.noteData.contentDetails){
                if(this.noteData.contentDetails.indexOf("src=\"/")>=0 ){
                  let reg=new RegExp("src=\"/","g")
                  this.noteData.contentDetails=this.noteData.contentDetails.replace(reg,"src=\""+this.$globalConfig.adressPath+"/");
                }
                if(this.noteData.contentDetails.indexOf("href=\"/")>=0){
                   let reg=new RegExp("href=\"/","g")
                  this.noteData.contentDetails=this.noteData.contentDetails.replace(reg,"href=\""+this.$globalConfig.adressPath+"/");
                  let reg1=new RegExp("title=\"","g")
                  this.noteData.contentDetails=this.noteData.contentDetails.replace(reg1,"download=\"");
                }
              }
            }
            this.loading = false;
            
          })
          .catch(err => {
            this.loading = false;
          });
        this.setFootStyle();
       
      },

      setFootStyle(){
        this.$nextTick(()=>{ // 页面渲染完成后的回调
                  this.getScreenHeight();
                  this.clientHeight = this.$refs.pages.offsetHeight+364;
                  // console.log(this.screenHeight,this.clientHeight);
                  if(this.screenHeight>this.clientHeight){
                    if(this.screenHeight-this.clientHeight>40){
                      emv.$emit("setfootmargintop",this.screenHeight-this.clientHeight);
                    }else{
                       emv.$emit("setfootmargintop",40);
                    }
                  }else{
                    emv.$emit("setfootmargintop",40);
                  }
                 
          });
      }
    },
  };
</script>
<style lang="less">
.breadcrumb{
  margin-top: 20px;
  margin-bottom: 15px;
  
}

</style>